/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package boundless.calculator;

import boundless.entities.Stats;

/**
 *
 * @author hendrikdekock
 */
public class DefensePlayerCalculator {
    
    
    public static int calculate(Stats s) {
        int total = 0;
        //Singles
        total += s.getSacks();
        //2 Points
        total += 2 * (s.getInterceptionswon() + s.getFumblesrecovered() + s.getSafeties());
        //6 Points
        total += 6 * (s.getDefensivetouchdowns() + s.getKickpuntreturntouchdowns());
        int points = s.getPointsallowed();
        if (points == 0)
            total += 10;
        else if (points <= 6)
            total += 7;
        else if (points <= 13)
            total += 4;
        else if (points <= 20)
            total += 1;
        else if (points > 28 && points <= 34)
            total -= 1;
        else
            total -= 4;
        return total;
    }
}
